@extends('layouts.backend')
@section('title')
    菜单列表
@endsection

@section('body')
    <div class="row">
        <div class="ibox">
            <div class="ibox-title">
                <h5>菜单列表</h5>
            </div>
            <div class="ibox-content">
                <div class="row">
                    <div class="col-md-6">
                        <form role="form" class="form-inline" method="get">
                            <div class="form-group">
                                <label for="keyword" class="sr-only">Name/Email</label>
                                <input type="text" placeholder="Enter name or email " value="{{request('keyword', '')}}" name="keyword" id="keyword" class="form-control">

                            </div>
                            <button class="btn btn-primary" type="submit">搜索</button>
                            <a href="{{ route('backend.menu.index') }}" class="btn btn-warning">重置</a>
                        </form>
                    </div>
                    <div class="col-md-6">
                        <a href="{{route('backend.menu.create')}}" class="btn btn-primary pull-right">添加菜单</a>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <ul class="list-group">
                            @foreach($menus as $menu)
                                <li class="list-group-item">
                                    <a href="{{route('backend.menu.edit', $menu)}}"><b>{{$menu->name}}</b></a>
                                    @include('components.backend.destroy', ['url' => route('backend.menu.destroy', $menu)])
                                </li>
                                @foreach($menu->children as $child)
                                    <li class="list-group-item">
                                        <a href="{{route('backend.menu.edit', $child)}}">|---- {{$child->name}}</a>
                                        @include('components.backend.destroy', ['url' => route('backend.menu.destroy', $child)])
                                    </li>
                                @endforeach
                            @endforeach
                        </ul>
                    </div>
                </div>
            </div>

        </div>
    </div>
@endsection
